package crossingtheriver;

public class CandidateCode {
	private static int bridge(int[] b, int i, int j) {
		if(i >= b.length)
			return 0;
		if(b[i] == j)
			return bridge(b, i + 1, b[i] + 1) + 1;
		if(b[i] > j)
			return Math.max(bridge(b, i + 1, b[i] + 1) + 1, bridge(b, i + 1, j));
		return bridge(b, i + 1, j);
	}
	public static int bridge(String[] input1) {
		int[] b = new int[input1.length];
		for(int i = 0; i < input1.length; i++) {
			String t[] = input1[i].split("#");
			b[i] = Integer.parseInt(t[1]);
		}
		return bridge(b, 0, 0);
	}
	public static void main(String[] args) {
		String[] input1 = {"1#2","2#4","3#1","4#5","5#3","6#6"};
		System.out.println(bridge(input1));
	}
}
